﻿//=============================================================
// Copyright (C) 2011 深圳市中旭企业管理股份有限公司
// 作 者：孙德响
// 日 期：2012-1-11
// 描 述: 一推讲师演讲总结业务处理类
//
// 版 本：1.00
// 修改历史纪录
// 版 本  修改时间      修改人            修改内容
// 1.00   2012/1/11    孙德响           
//=============================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZX.BLL.Extend;
using ZX.SYS.Library;
using ZX.CRM.Library;
using System.Data.SqlClient;
using System.Data;
namespace ZX.CRM.Bussiness
{
    public class BCrmTeachSumup : BaseBussnies
    {
        /// <summary>
        /// 获取字典数据
        /// </summary>
        /// <param name="ClassId">ID</param>
        /// <returns></returns>
        public IList<DatPhraseDetail> GetDatPhraseDetailByClassId(Guid ClassId)
        {
            this.entity = new DatPhraseDetail();
            return GetEntitysBySqlComm<DatPhraseDetail>("select * from DatPhraseDetail where ClassID='" + ClassId + "' order by Seq");
        }
        /// <summary>
        /// 获取订单信息
        /// </summary>
        /// <param name="ClassId">ID</param>
        /// <returns></returns>
        public IList<V_CrmCustomerOrder> GetOrderDetail(Guid CustomerId)
        {
            this.entity = new V_CrmCustomerOrder();
            return GetEntitys<V_CrmCustomerOrder>("CustomerId='" + CustomerId + "' and stateid in('af73673f-9fec-4d14-acfd-b0fce08d6ffa') and TypeID='5e50217a-414e-46d5-89bc-348ad0145ffc'");
        }
        /// <summary>
        /// 获取评论信息
        /// </summary>
        /// <param name="ClassId">ID</param>
        /// <returns></returns>
        public IList<CrmInnerComment> GetCommentDetail(Guid sumid)
        {
            this.entity = new CrmInnerComment();
            return GetEntitys<CrmInnerComment>("InnerSumID='" + sumid + "' order by addtime desc");
        }
        /// <summary>
        /// 保存存储过程
        /// </summary>
        /// <param name="VcrmteachSumup"></param>
        /// <param name="TYPE"></param>
        /// <returns></returns>
        public string ExecProc(V_CrmTeachSumup VcrmteachSumup,int  TYPE)
        {
            string returnstr = "";
            SqlParameter Id = new SqlParameter("@Id", SqlDbType.UniqueIdentifier, 50);
            Id.Direction = ParameterDirection.Input;
            Id.Value = VcrmteachSumup.ID;
            SqlParameter Code = new SqlParameter("@Code", SqlDbType.Char, 10);
            Code.Direction = ParameterDirection.Input;
            Code.Value = VcrmteachSumup.Code;
            SqlParameter orderID = new SqlParameter("@orderID", SqlDbType.UniqueIdentifier, 50);
            orderID.Direction = ParameterDirection.Input;
            orderID.Value = VcrmteachSumup.OrderId;
            SqlParameter ThodometerId = new SqlParameter("@ThodometerId", SqlDbType.UniqueIdentifier, 50);
            ThodometerId.Direction = ParameterDirection.Input;
            ThodometerId.Value = VcrmteachSumup.ThodometerId;
            SqlParameter PrelectDate = new SqlParameter("@PrelectDate", SqlDbType.DateTime, 50);
            PrelectDate.Direction = ParameterDirection.Input;
            PrelectDate.Value = VcrmteachSumup.PrelectDate;
            SqlParameter IsBargain = new SqlParameter("@IsBargain", SqlDbType.Char, 1);
            IsBargain.Direction = ParameterDirection.Input;
            IsBargain.Value = VcrmteachSumup.IsBargain;
            SqlParameter IsStandard = new SqlParameter("@IsStandard", SqlDbType.Char, 1);
            IsStandard.Direction = ParameterDirection.Input;
            IsStandard.Value = VcrmteachSumup.IsStandard;
            SqlParameter IsValue = new SqlParameter("@IsValue", SqlDbType.Char, 1);
            IsValue.Direction = ParameterDirection.Input;
            IsValue.Value = VcrmteachSumup.IsValue;
            SqlParameter JWXID = new SqlParameter("@JWXID", SqlDbType.UniqueIdentifier, 50);
            JWXID.Direction = ParameterDirection.Input;
            JWXID.Value = VcrmteachSumup.JWXID;
            SqlParameter IsGripe = new SqlParameter("@IsGripe", SqlDbType.Char, 1);
            IsGripe.Direction = ParameterDirection.Input;
            IsGripe.Value = VcrmteachSumup.IsGripe;
            SqlParameter GripeExplain = new SqlParameter("@GripeExplain", SqlDbType.NVarChar, 50);
            GripeExplain.Direction = ParameterDirection.Input;
            GripeExplain.Value = VcrmteachSumup.GripeExplain;
            SqlParameter ISCLASS = new SqlParameter("@ISCLASS", SqlDbType.Char, 1);
            ISCLASS.Direction = ParameterDirection.Input;
            ISCLASS.Value = VcrmteachSumup.IsClass;
            SqlParameter ClassExplain = new SqlParameter("@ClassExplain", SqlDbType.NVarChar, 50);
            ClassExplain.Direction = ParameterDirection.Input;
            ClassExplain.Value = VcrmteachSumup.ClassExplain;
            SqlParameter TeachPlace = new SqlParameter("@TeachPlace", SqlDbType.NVarChar, 30);
            TeachPlace.Direction = ParameterDirection.Input;
            TeachPlace.Value = VcrmteachSumup.TeachPlace;
            SqlParameter CustomerPromis = new SqlParameter("@CustomerPromis", SqlDbType.NVarChar, 100);
            CustomerPromis.Direction = ParameterDirection.Input;
            CustomerPromis.Value = VcrmteachSumup.CustomerPromis;
            SqlParameter TutorId = new SqlParameter("@TutorId", SqlDbType.UniqueIdentifier, 50);
            TutorId.Direction = ParameterDirection.Input;
            TutorId.Value = VcrmteachSumup.TutorId;
            SqlParameter DeptId = new SqlParameter("@DeptId", SqlDbType.UniqueIdentifier, 50);
            DeptId.Direction = ParameterDirection.Input;
            DeptId.Value = VcrmteachSumup.DeptId;
            SqlParameter Explain = new SqlParameter("@Explain", SqlDbType.NVarChar, 500);
            Explain.Direction = ParameterDirection.Input;
            Explain.Value = VcrmteachSumup.Explain;
            SqlParameter Adduser = new SqlParameter("@Adduser", SqlDbType.UniqueIdentifier, 50);
            Adduser.Direction = ParameterDirection.Input;
            Adduser.Value = VcrmteachSumup.Adduser;
            SqlParameter Addtime = new SqlParameter("@Addtime", SqlDbType.DateTime, 50);
            Addtime.Direction = ParameterDirection.Input;
            Addtime.Value = VcrmteachSumup.Addtime;
            SqlParameter PersonSum = new SqlParameter("@PersonSum", SqlDbType.Int, 50);
            PersonSum.Direction = ParameterDirection.Input;
            PersonSum.Value = VcrmteachSumup.PersonSum;

            SqlParameter ProductSum = new SqlParameter("@ProductSum", SqlDbType.Decimal, 50);
            ProductSum.Direction = ParameterDirection.Input;
            ProductSum.Value = VcrmteachSumup.ProductSum;
            SqlParameter CompanyGain = new SqlParameter("@CompanyGain", SqlDbType.NVarChar, 20);
            CompanyGain.Direction = ParameterDirection.Input;
            CompanyGain.Value = VcrmteachSumup.CompanyGain;

            SqlParameter TrainHistory = new SqlParameter("@TrainHistory", SqlDbType.NVarChar, 50);
            TrainHistory.Direction = ParameterDirection.Input;
            TrainHistory.Value = VcrmteachSumup.TrainHistory;

            SqlParameter Painful = new SqlParameter("@Painful", SqlDbType.NVarChar, 500);
            Painful.Direction = ParameterDirection.Input;
            Painful.Value = VcrmteachSumup.Painful;

            SqlParameter Pullulation = new SqlParameter("@Pullulation", SqlDbType.NVarChar, 200);
            Pullulation.Direction = ParameterDirection.Input;
            Pullulation.Value = VcrmteachSumup.Pullulation;

            SqlParameter Homeplace = new SqlParameter("@Homeplace", SqlDbType.NVarChar, 30);
            Homeplace.Direction = ParameterDirection.Input;
            Homeplace.Value = VcrmteachSumup.Homeplace;


            SqlParameter BirthdayType = new SqlParameter("@BirthdayType", SqlDbType.NVarChar, 2);
            BirthdayType.Direction = ParameterDirection.Input;
            BirthdayType.Value = VcrmteachSumup.BirthdayType;

            SqlParameter DecisionBirthday = new SqlParameter("@DecisionBirthday", SqlDbType.DateTime, 20);
            DecisionBirthday.Direction = ParameterDirection.Input;
            DecisionBirthday.Value = VcrmteachSumup.DecisionBirthday;

            SqlParameter Character = new SqlParameter("@Character", SqlDbType.NVarChar, 30);
            Character.Direction = ParameterDirection.Input;
            Character.Value = VcrmteachSumup.Character;

            SqlParameter SchoolScientifc = new SqlParameter("@SchoolScientifc", SqlDbType.NVarChar, 30);
            SchoolScientifc.Direction = ParameterDirection.Input;
            SchoolScientifc.Value = VcrmteachSumup.SchoolScientifc;

            SqlParameter DecisionFancy = new SqlParameter("@DecisionFancy", SqlDbType.NVarChar, 30);
            DecisionFancy.Direction = ParameterDirection.Input;
            DecisionFancy.Value = VcrmteachSumup.DecisionFancy;

            SqlParameter Credit = new SqlParameter("@Credit", SqlDbType.NVarChar, 100);
            Credit.Direction = ParameterDirection.Input;
            Credit.Value = VcrmteachSumup.Credit;

            SqlParameter CompanyCreateDate = new SqlParameter("@CompanyCreateDate", SqlDbType.DateTime, 100);
            CompanyCreateDate.Direction = ParameterDirection.Input;
            CompanyCreateDate.Value = VcrmteachSumup.CompanyCreateDate;

            SqlParameter DecisionPersonsun = new SqlParameter("@DecisionPersonsun", SqlDbType.Int, 100);
            DecisionPersonsun.Direction = ParameterDirection.Input;
            DecisionPersonsun.Value = VcrmteachSumup.DecisionPersonsun;

            SqlParameter HighPersonsum = new SqlParameter("@HighPersonsum", SqlDbType.Int, 100);
            HighPersonsum.Direction = ParameterDirection.Input;
            HighPersonsum.Value = VcrmteachSumup.HighPersonsum;

            SqlParameter MiddlePersonsum = new SqlParameter("@MiddlePersonsum", SqlDbType.Int, 100);
            MiddlePersonsum.Direction = ParameterDirection.Input;
            MiddlePersonsum.Value = VcrmteachSumup.MiddlePersonsum;

            SqlParameter BelowPersonsum = new SqlParameter("@BelowPersonsum", SqlDbType.Int, 100);
            BelowPersonsum.Direction = ParameterDirection.Input;
            BelowPersonsum.Value = VcrmteachSumup.BelowPersonsum;

            SqlParameter TrainCompany = new SqlParameter("@TrainCompany", SqlDbType.NVarChar, 50);
            TrainCompany.Direction = ParameterDirection.Input;
            TrainCompany.Value = VcrmteachSumup.TrainCompany;


            SqlParameter TrainDate = new SqlParameter("@TrainDate", SqlDbType.NVarChar, 50);
            TrainDate.Direction = ParameterDirection.Input;
            TrainDate.Value = VcrmteachSumup.TrainDate;

            SqlParameter CustomerPhylogeny = new SqlParameter("@CustomerPhylogeny", SqlDbType.NVarChar, 500);
            CustomerPhylogeny.Direction = ParameterDirection.Input;
            CustomerPhylogeny.Value = VcrmteachSumup.CustomerPhylogeny;

            SqlParameter BargainReason = new SqlParameter("@BargainReason", SqlDbType.NVarChar, 500);
            BargainReason.Direction = ParameterDirection.Input;
            BargainReason.Value = VcrmteachSumup.BargainReason;

            SqlParameter BargainDispute = new SqlParameter("@BargainDispute", SqlDbType.NVarChar, 500);
            BargainDispute.Direction = ParameterDirection.Input;
            BargainDispute.Value = VcrmteachSumup.BargainDispute;

            SqlParameter AffectDecisioner = new SqlParameter("@AffectDecisioner", SqlDbType.NVarChar, 50);
            AffectDecisioner.Direction = ParameterDirection.Input;
            AffectDecisioner.Value = VcrmteachSumup.AffectDecisioner;

            SqlParameter BargainNum = new SqlParameter("@BargainNum", SqlDbType.Int, 100);
            BargainNum.Direction = ParameterDirection.Input;
            BargainNum.Value = VcrmteachSumup.BargainNum;

            SqlParameter ReturnValue = new SqlParameter("@ReturnValue", SqlDbType.NVarChar, 50);
            ReturnValue.Direction = ParameterDirection.Output;
            IDataParameter[] parameters = new IDataParameter[] { Id, Code, orderID, ThodometerId,PrelectDate,IsBargain,IsStandard,IsValue,JWXID,IsGripe
                ,GripeExplain,ISCLASS,ClassExplain,TeachPlace, CustomerPromis, 
                TutorId, DeptId, Explain, Adduser, Addtime, PersonSum, ProductSum, CompanyGain, TrainHistory, Painful, Pullulation
                ,Homeplace,BirthdayType,DecisionBirthday,Character ,SchoolScientifc,DecisionFancy
                ,Credit,CompanyCreateDate,DecisionPersonsun,HighPersonsum,MiddlePersonsum,BelowPersonsum,TrainCompany,TrainDate,CustomerPhylogeny,BargainReason,BargainDispute,AffectDecisioner,BargainNum, ReturnValue};
            int IResult = 0;
            ZX.DAL.DBExtend.DbSql ExecPro = new DAL.DBExtend.DbSql();
            if (TYPE == 0)
            {
                returnstr = ExecPro.RunProcedureReturnString("sp_AddCrmTeachSumup", parameters, out IResult);
            }
            else if (TYPE == 1)
            {
                returnstr = ExecPro.RunProcedureReturnString("sp_UpdateCrmTeachSumup", parameters, out IResult);
            }
            return returnstr;
        }
        /// <summary>
        /// 保存存储过程
        /// </summary>
        /// <param name="VcrmteachSumup"></param>
        /// <param name="TYPE"></param>
        /// <returns></returns>
        public string ExecProc(V_CrmTeaSumSave VcrmteachSumup, int TYPE)
        {
            string returnstr = "";
            SqlParameter Id = new SqlParameter("@Id", SqlDbType.UniqueIdentifier, 50);
            Id.Direction = ParameterDirection.Input;
            if (TYPE == 1)
            {
                Id.Value = new Guid(VcrmteachSumup.EXP4);
            }
            else
            {
                Id.Value = Guid.NewGuid();
            }
            SqlParameter Code = new SqlParameter("@Code", SqlDbType.Char, 10);
            Code.Direction = ParameterDirection.Input;
            Code.Value = VcrmteachSumup.Code;
            SqlParameter orderID = new SqlParameter("@orderID", SqlDbType.UniqueIdentifier, 50);
            orderID.Direction = ParameterDirection.Input;
            orderID.Value = VcrmteachSumup.OrderId;
            SqlParameter ThodometerId = new SqlParameter("@ThodometerId", SqlDbType.UniqueIdentifier, 50);
            ThodometerId.Direction = ParameterDirection.Input;
            ThodometerId.Value = VcrmteachSumup.ThodometerId;
            SqlParameter PrelectDate = new SqlParameter("@PrelectDate", SqlDbType.DateTime, 50);
            PrelectDate.Direction = ParameterDirection.Input;
            PrelectDate.Value = VcrmteachSumup.PrelectDate;
            SqlParameter IsBargain = new SqlParameter("@IsBargain", SqlDbType.Char, 1);
            IsBargain.Direction = ParameterDirection.Input;
            IsBargain.Value = VcrmteachSumup.IsBargain;
            SqlParameter IsStandard = new SqlParameter("@IsStandard", SqlDbType.Char, 1);
            IsStandard.Direction = ParameterDirection.Input;
            IsStandard.Value = VcrmteachSumup.IsStandard;
            SqlParameter IsValue = new SqlParameter("@IsValue", SqlDbType.Char, 1);
            IsValue.Direction = ParameterDirection.Input;
            IsValue.Value = VcrmteachSumup.IsValue;
            SqlParameter JWXID = new SqlParameter("@JWXID", SqlDbType.UniqueIdentifier, 50);
            JWXID.Direction = ParameterDirection.Input;
            JWXID.Value = VcrmteachSumup.JWXID;
            SqlParameter IsGripe = new SqlParameter("@IsGripe", SqlDbType.Char, 1);
            IsGripe.Direction = ParameterDirection.Input;
            IsGripe.Value = VcrmteachSumup.IsGripe;
            SqlParameter GripeExplain = new SqlParameter("@GripeExplain", SqlDbType.NVarChar, 50);
            GripeExplain.Direction = ParameterDirection.Input;
            GripeExplain.Value = VcrmteachSumup.GripeExplain;
            SqlParameter ISCLASS = new SqlParameter("@ISCLASS", SqlDbType.Char, 1);
            ISCLASS.Direction = ParameterDirection.Input;
            ISCLASS.Value = VcrmteachSumup.IsClass;
            SqlParameter ClassExplain = new SqlParameter("@ClassExplain", SqlDbType.NVarChar, 50);
            ClassExplain.Direction = ParameterDirection.Input;
            ClassExplain.Value = VcrmteachSumup.ClassExplain;
            SqlParameter TeachPlace = new SqlParameter("@TeachPlace", SqlDbType.NVarChar, 30);
            TeachPlace.Direction = ParameterDirection.Input;
            TeachPlace.Value = VcrmteachSumup.TeachPlace;
            SqlParameter CustomerPromis = new SqlParameter("@CustomerPromis", SqlDbType.NChar, 50);
            CustomerPromis.Direction = ParameterDirection.Input;
            CustomerPromis.Value = VcrmteachSumup.CustomerPromis;
            SqlParameter TutorId = new SqlParameter("@TutorId", SqlDbType.UniqueIdentifier, 50);
            TutorId.Direction = ParameterDirection.Input;
            TutorId.Value = VcrmteachSumup.TutorId;
            SqlParameter DeptId = new SqlParameter("@DeptId", SqlDbType.UniqueIdentifier, 50);
            DeptId.Direction = ParameterDirection.Input;
            DeptId.Value = VcrmteachSumup.DeptId;
            SqlParameter Explain = new SqlParameter("@Explain", SqlDbType.NVarChar, 500);
            Explain.Direction = ParameterDirection.Input;
            Explain.Value = VcrmteachSumup.Explain;
            SqlParameter Adduser = new SqlParameter("@Adduser", SqlDbType.UniqueIdentifier, 50);
            Adduser.Direction = ParameterDirection.Input;
            Adduser.Value = VcrmteachSumup.Adduser;
            SqlParameter Addtime = new SqlParameter("@Addtime", SqlDbType.DateTime, 50);
            Addtime.Direction = ParameterDirection.Input;
            Addtime.Value = VcrmteachSumup.Addtime;
            SqlParameter PersonSum = new SqlParameter("@PersonSum", SqlDbType.Int, 50);
            PersonSum.Direction = ParameterDirection.Input;
            PersonSum.Value = VcrmteachSumup.PersonSum;

            SqlParameter ProductSum = new SqlParameter("@ProductSum", SqlDbType.Decimal, 50);
            ProductSum.Direction = ParameterDirection.Input;
            ProductSum.Value = VcrmteachSumup.ProductSum;
            SqlParameter CompanyGain = new SqlParameter("@CompanyGain", SqlDbType.NVarChar, 20);
            CompanyGain.Direction = ParameterDirection.Input;
            CompanyGain.Value = VcrmteachSumup.CompanyGain;

            SqlParameter TrainHistory = new SqlParameter("@TrainHistory", SqlDbType.NVarChar, 50);
            TrainHistory.Direction = ParameterDirection.Input;
            TrainHistory.Value = VcrmteachSumup.TrainHistory;

            SqlParameter Painful = new SqlParameter("@Painful", SqlDbType.NVarChar, 50);
            Painful.Direction = ParameterDirection.Input;
            Painful.Value = VcrmteachSumup.Painful;

            SqlParameter Pullulation = new SqlParameter("@Pullulation", SqlDbType.NVarChar, 200);
            Pullulation.Direction = ParameterDirection.Input;
            Pullulation.Value = VcrmteachSumup.Pullulation;

            SqlParameter Homeplace = new SqlParameter("@Homeplace", SqlDbType.NVarChar, 30);
            Homeplace.Direction = ParameterDirection.Input;
            Homeplace.Value = VcrmteachSumup.Homeplace;


            SqlParameter BirthdayType = new SqlParameter("@BirthdayType", SqlDbType.NVarChar, 2);
            BirthdayType.Direction = ParameterDirection.Input;
            BirthdayType.Value = VcrmteachSumup.BirthdayType;

            SqlParameter DecisionBirthday = new SqlParameter("@DecisionBirthday", SqlDbType.DateTime, 20);
            DecisionBirthday.Direction = ParameterDirection.Input;
            DecisionBirthday.Value = VcrmteachSumup.DecisionBirthday;

            SqlParameter Character = new SqlParameter("@Character", SqlDbType.NVarChar, 30);
            Character.Direction = ParameterDirection.Input;
            Character.Value = VcrmteachSumup.Character;

            SqlParameter SchoolScientifc = new SqlParameter("@SchoolScientifc", SqlDbType.NVarChar, 30);
            SchoolScientifc.Direction = ParameterDirection.Input;
            SchoolScientifc.Value = VcrmteachSumup.SchoolScientifc;

            SqlParameter DecisionFancy = new SqlParameter("@DecisionFancy", SqlDbType.NVarChar, 30);
            DecisionFancy.Direction = ParameterDirection.Input;
            DecisionFancy.Value = VcrmteachSumup.DecisionFancy;

            SqlParameter Credit = new SqlParameter("@Credit", SqlDbType.NVarChar, 100);
            Credit.Direction = ParameterDirection.Input;
            Credit.Value = VcrmteachSumup.Credit;

            SqlParameter CompanyCreateDate = new SqlParameter("@CompanyCreateDate", SqlDbType.DateTime, 100);
            CompanyCreateDate.Direction = ParameterDirection.Input;
            CompanyCreateDate.Value = VcrmteachSumup.CompanyCreateDate;

            SqlParameter DecisionPersonsun = new SqlParameter("@DecisionPersonsun", SqlDbType.Int, 100);
            DecisionPersonsun.Direction = ParameterDirection.Input;
            DecisionPersonsun.Value = VcrmteachSumup.DecisionPersonsun;

            SqlParameter HighPersonsum = new SqlParameter("@HighPersonsum", SqlDbType.Int, 100);
            HighPersonsum.Direction = ParameterDirection.Input;
            HighPersonsum.Value = VcrmteachSumup.HighPersonsum;

            SqlParameter MiddlePersonsum = new SqlParameter("@MiddlePersonsum", SqlDbType.Int, 100);
            MiddlePersonsum.Direction = ParameterDirection.Input;
            MiddlePersonsum.Value = VcrmteachSumup.MiddlePersonsum;

            SqlParameter BelowPersonsum = new SqlParameter("@BelowPersonsum", SqlDbType.Int, 100);
            BelowPersonsum.Direction = ParameterDirection.Input;
            BelowPersonsum.Value = VcrmteachSumup.BelowPersonsum;

            SqlParameter TrainCompany = new SqlParameter("@TrainCompany", SqlDbType.NVarChar, 50);
            TrainCompany.Direction = ParameterDirection.Input;
            TrainCompany.Value = VcrmteachSumup.TrainCompany;


            SqlParameter TrainDate = new SqlParameter("@TrainDate", SqlDbType.NVarChar, 50);
            TrainDate.Direction = ParameterDirection.Input;
            TrainDate.Value = VcrmteachSumup.TrainDate;

            SqlParameter CustomerPhylogeny = new SqlParameter("@CustomerPhylogeny", SqlDbType.NVarChar, 200);
            CustomerPhylogeny.Direction = ParameterDirection.Input;
            CustomerPhylogeny.Value = VcrmteachSumup.CustomerPhylogeny;

            SqlParameter BargainReason = new SqlParameter("@BargainReason", SqlDbType.NVarChar, 100);
            BargainReason.Direction = ParameterDirection.Input;
            BargainReason.Value = VcrmteachSumup.BargainReason;

            SqlParameter BargainDispute = new SqlParameter("@BargainDispute", SqlDbType.NVarChar, 200);
            BargainDispute.Direction = ParameterDirection.Input;
            BargainDispute.Value = VcrmteachSumup.BargainDispute;

            SqlParameter AffectDecisioner = new SqlParameter("@AffectDecisioner", SqlDbType.NVarChar, 50);
            AffectDecisioner.Direction = ParameterDirection.Input;
            AffectDecisioner.Value = VcrmteachSumup.AffectDecisioner;

            SqlParameter BargainNum = new SqlParameter("@BargainNum", SqlDbType.Int, 100);
            BargainNum.Direction = ParameterDirection.Input;
            BargainNum.Value = VcrmteachSumup.BargainNum;

            SqlParameter ReturnValue = new SqlParameter("@ReturnValue", SqlDbType.NVarChar, 50);
            ReturnValue.Direction = ParameterDirection.Output;
            IDataParameter[] parameters = new IDataParameter[] { Id, Code, orderID, ThodometerId,PrelectDate,IsBargain,IsStandard,IsValue,JWXID,IsGripe
                ,GripeExplain,ISCLASS,ClassExplain,TeachPlace, CustomerPromis, 
                TutorId, DeptId, Explain, Adduser, Addtime, PersonSum, ProductSum, CompanyGain, TrainHistory, Painful, Pullulation
                ,Homeplace,BirthdayType,DecisionBirthday,Character ,SchoolScientifc,DecisionFancy
                ,Credit,CompanyCreateDate,DecisionPersonsun,HighPersonsum,MiddlePersonsum,BelowPersonsum,TrainCompany,TrainDate,CustomerPhylogeny,BargainReason,BargainDispute,AffectDecisioner,BargainNum, ReturnValue};
            int IResult = 0;
            ZX.DAL.DBExtend.DbSql ExecPro = new DAL.DBExtend.DbSql();
            if (TYPE == 0)
            {
                returnstr = ExecPro.RunProcedureReturnString("sp_AddCrmTeachSumup", parameters, out IResult);
            }
            else if (TYPE == 1)
            {
                returnstr = ExecPro.RunProcedureReturnString("sp_UpdateCrmTeachSumup", parameters, out IResult);
            }

            return returnstr;
        }
    }
}
